package sprintServer.start;

import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.SQLException;

import sprintServer.dbconnect.Conn;

public class LogoutClient {
	StringBuffer sql = new StringBuffer();
	Connection con ;
	PreparedStatement pstmt;

	public String logout(String id, String pw){
		String result="";
		sql.append("update state from join");
		sql.append("where id = ? ");
		sql.append("and pw = ? ");
		try{
			con = Conn.getConnection();
			pstmt = con.prepareStatement(sql.toString());
			pstmt.setString(1, id);
			pstmt.setString(2, pw);
			int check = pstmt.executeUpdate(sql.toString());
			if(check > 0){
				result = "success";
			}else {
				result = "false";
			}
			
		}catch(SQLException se){}
		finally{
			
			try{if(pstmt != null)pstmt.close();}catch	(SQLException se1){}
			try{if(con != null)con.close();}catch	(SQLException se1){}			
		}
		return result;
	}
}
